/* 
 @description: 后台首页

 @author: 韦淇霰

 @update: 2021年9月2日14:55:35
 */
// window.onload=function(){
//     setTimeout("getTimeNow()",1000);
// }
    const lis =document.querySelectorAll('.d')
    const b_menu = document.querySelectorAll('.b_menu');
    const imgArr = document.querySelectorAll('.fa-chevron-right');
    let sum = 0;
    for(let i=0;i<lis.length;i++){
        lis[i].onclick=function(){
            sum++;
            if(sum % 2 !==0){
                b_menu[i].style.display='block'
                b_menu[i].style.height = 50 + "px";
                imgArr[i].style.transform = "rotateZ(90deg)";
                imgArr[i].style.transformOrigin = (80+"%",80+"%")
                imgArr[i].style.transition = "all 0.01s";
            }else{
                b_menu[i].style.display='none'
                b_menu[i].style.height = 0 + "px";
                imgArr[i].style.transform = "rotateZ(0deg)";
                imgArr[i].style.transformOrigin = (80+"%",80+"%")
                imgArr[i].style.transition = "all 0.01s";
            }
        }
    }
    
    function ch() {
        for (var i = 0; i <  lis.length; i++) {
            lis[i].addEventListener('click', function() {
                for (var i = 0; i < lis.length; i++) {
                    lis[i].style.backgroundColor = '#222324'
                }
                this.style.backgroundColor = '#111111'
            })
        }
    }
    ch()
    const tb = document.querySelector('.tb');
    const left_menu = document.querySelector('.left_menu');
    const ctta = document.querySelector('.content_area')
    let num = 0;
    tb.onclick = function(){
        num ++;
        if(num % 2 !==0){
            left_menu.style.width = 0 + "px";
            ctta.style.width = 1903 + "px";
            left_menu.style.position = 'static';
            ctta.style.transition = "all 0.2s";
            left_menu.style.transition = "all 0.2s";
          
        }else{
            left_menu.style.width = 220 + "px";
            left_menu.style.position = 'fixed';
            ctta.style.width = 1683 + "px";
        }
    }
    const names =  localStorage.getItem('ador_name');
    $(".yh").html(names);

    const gltotal =  localStorage.getItem('gltotal');
    $("#gltotal").html(gltotal);

    const ddtotal =  localStorage.getItem('ddtotal');
    $("#ddtotal").html(ddtotal);

    const wdtotal =  localStorage.getItem('wdtotal');
    $("#wdtotal").html(wdtotal);

    const zxtotal =  localStorage.getItem('zxtotal');
    $("#zxtotal").html(zxtotal);

    function getTimeNow() {
        var time = new Date();
        var hour = time.getHours();
        var minute = time.getMinutes();
        var second = time.getSeconds();
        
        var week; 
        var date;
        if(time.getDay()==0) week="星期日";
        if(time.getDay()==1) week="星期一";
        if(time.getDay()==2) week="星期二";
        if(time.getDay()==3) week="星期三";
        if(time.getDay()==4) week="星期四";
        if(time.getDay()==5) week="星期五";
        if(time.getDay()==6) week="星期六";
        date=(time.getFullYear())+"年"+(time.getMonth()+1)+"月"+time.getDate()+"日"+" ";
        document.getElementById("nowTime").innerHTML ="当前时间："+ date + week + hour + ":" + minute + ":" + second;
        setTimeout("getTimeNow()",1000);
        }

        const judgeqx = localStorage.getItem('judgeqx');
        console.log(judgeqx);
        const lul = document.getElementById('gl');
        if(judgeqx == 0){
            lul.innerHTML = `<a>
                <i class="fa fa-user-circle" aria-hidden="true"></i>
                    管理员信息管理 
                <i class="fa fa-chevron-right" aria-hidden="true"></i>
            </a>`;
        }else if(judgeqx === 1){
            lul.innerHTML = `
            <a href="javascript:;">
                <i class="fa fa-user-circle" aria-hidden="true"></i>
                管理员信息管理
                <i class="fa fa-chevron-right" aria-hidden="true"></i>
             </a>
                <ul class = "b_menu">
                    <li>
                        <a href="./Admin.html">
                            <i class="fa fa-chevron-circle-right" aria-hidden="true"></i>&nbsp;&nbsp;&nbsp;管理员列表
                        </a>
                    </li>
                </ul>`;
        }
     const tc = document.querySelector('#tc');
     console.log(tc);
     tc.onclick = function(){
        let y = confirm('确定退出吗?');
         if(y){
             window.location.href='./Login.html';
         }else{
            //  window.location.href='./'
         }
     }



